var detectCycle = function(head) {
    if(!head) return null
    let sort = head,
        fast = head;
    while(fast.next&&fast.next.next){
        sort=sort.next
        fast=fast.next.next
        if(sort==fast){
            let p=head
            while(p!=sort){
                sort=sort.next
                p=p.next
            }
            return p
        }
    }
    return null
};